//
//  KeyframeAnimationViewModel.m
//  Home
//
//  Created by 曹连华 on 2019/6/28.
//  Copyright © 2019 曹连华. All rights reserved.
//

#import "KeyframeAnimationViewModel.h"


@implementation KeyframeAnimationViewModel

- (void)resetDataSource {
    [self reloadDataSourceIsValuesType:YES];
}

- (void)reloadDataSourceIsValuesType:(BOOL)isValuesType {
    if (isValuesType) {
        NSLog(@"Value");
        [self.dataSource resetRowListInSection:[self valuesAnimationRows]];
    } else {
        NSLog(@"Path");
        [self.dataSource resetRowListInSection:[self pathAnimationRows]];
    }
}

- (NSArray *)valuesAnimationRows {
    NSArray *values0 = @[@0.0,@M_PI_2,@M_PI,@(1.5*M_PI),@(2*M_PI)];
    NSArray *keyTimes0 = @[@0.0,@0.25,@0.5,@0.75,@1.0];
    NSArray *timingFunctions0 = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]
                                  ];
    KeyframeAnimationTVCellModel *row0 = [[KeyframeAnimationTVCellModel alloc]initWithCellClass:@"KeyframeAnimationTVCell" mainTitle:@"旋转动画(默认z轴)" subTitle:@"transform.rotation" values:values0 keyTimes:keyTimes0 timingFunctions:timingFunctions0];
    
    NSArray *values1 = @[@0.0,@M_PI_2,@M_PI,@(1.5*M_PI),@(2*M_PI)];
    NSArray *keyTimes1 = @[@0.0,@0.1,@0.5,@0.75,@1.0];
    NSArray *timingFunctions1 = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]
                                  ];
    KeyframeAnimationTVCellModel *row1 = [[KeyframeAnimationTVCellModel alloc]initWithCellClass:@"KeyframeAnimationTVCell" mainTitle:@"绕X轴旋转动画" subTitle:@"transform.rotation.x" values:values1 keyTimes:keyTimes1 timingFunctions:timingFunctions1];
    
    NSArray *values2 = @[@0.0,@M_PI_2,@M_PI,@(1.5*M_PI),@(2*M_PI)];
    NSArray *keyTimes2 = @[@0.0,@0.1,@0.5,@0.75,@1.0];
    NSArray *timingFunctions2 = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]
                                  ];
    KeyframeAnimationTVCellModel *row2 = [[KeyframeAnimationTVCellModel alloc]initWithCellClass:@"KeyframeAnimationTVCell" mainTitle:@"绕Y轴旋转动画" subTitle:@"transform.rotation.y" values:values2 keyTimes:keyTimes2 timingFunctions:timingFunctions2];
    
    NSArray *values3 = @[@1.0,@0.5,@0.0,@1.0,@2.0];
    NSArray *keyTimes3 = @[@0.0,@0.1,@0.5,@0.75,@1.0];
    NSArray *timingFunctions3 = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]
                                  ];
    KeyframeAnimationTVCellModel *row3 = [[KeyframeAnimationTVCellModel alloc]initWithCellClass:@"KeyframeAnimationTVCell" mainTitle:@"缩放动画(默认z轴)" subTitle:@"transform.scale" values:values3 keyTimes:keyTimes3 timingFunctions:timingFunctions3];
    
    NSArray *values4 = @[@1.0,@0.5,@0.0,@1.0,@2.0];
    NSArray *keyTimes4 = @[@0.0,@0.1,@0.5,@0.75,@1.0];
    NSArray *timingFunctions4 = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]
                                  ];
    KeyframeAnimationTVCellModel *row4 = [[KeyframeAnimationTVCellModel alloc]initWithCellClass:@"KeyframeAnimationTVCell" mainTitle:@"绕X轴缩放动画" subTitle:@"transform.scale.x" values:values4 keyTimes:keyTimes4 timingFunctions:timingFunctions4];
    
    NSArray *values5 = @[@1.0,@0.5,@0.0,@1.0,@2.0];
    NSArray *keyTimes5 = @[@0.0,@0.1,@0.5,@0.75,@1.0];
    NSArray *timingFunctions5 = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]
                                  ];
    KeyframeAnimationTVCellModel *row5 = [[KeyframeAnimationTVCellModel alloc]initWithCellClass:@"KeyframeAnimationTVCell" mainTitle:@"绕Y轴缩放动画" subTitle:@"transform.scale.y" values:values5 keyTimes:keyTimes5 timingFunctions:timingFunctions5];
    
    NSArray *values6 = @[[NSValue valueWithCGPoint:CGPointMake(0, 0)],
                         [NSValue valueWithCGPoint:CGPointMake(50, 100)],
                         [NSValue valueWithCGPoint:CGPointMake(0, 100)],
                         [NSValue valueWithCGPoint:CGPointMake(0, 200)],
                         [NSValue valueWithCGPoint:CGPointMake(50, 100)]];
    NSArray *keyTimes6 = @[@0.0,@0.1,@0.5,@0.75,@1.0];
    NSArray *timingFunctions6 = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]
                                  ];
    KeyframeAnimationTVCellModel *row6 = [[KeyframeAnimationTVCellModel alloc]initWithCellClass:@"KeyframeAnimationTVCell" mainTitle:@"位移动画" subTitle:@"transform.translation" values:values6 keyTimes:keyTimes6 timingFunctions:timingFunctions6];
    
    NSArray *values7 = @[@(0),@(50),@(100),@(150),@(50)];
    NSArray *keyTimes7 = @[@0.0,@0.1,@0.5,@0.75,@1.0];
    NSArray *timingFunctions7 = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]
                                  ];
    KeyframeAnimationTVCellModel *row7 = [[KeyframeAnimationTVCellModel alloc]initWithCellClass:@"KeyframeAnimationTVCell" mainTitle:@"X轴位移动画" subTitle:@"transform.translation.x" values:values7 keyTimes:keyTimes7 timingFunctions:timingFunctions7];
    
    NSArray *values8 = @[@(0),@(50),@(100),@(150),@(200)];
    NSArray *keyTimes8 = @[@0.0,@0.1,@0.5,@0.75,@1.0];
    NSArray *timingFunctions8 = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]
                                  ];
    KeyframeAnimationTVCellModel *row8 = [[KeyframeAnimationTVCellModel alloc]initWithCellClass:@"KeyframeAnimationTVCell" mainTitle:@"Y轴位移动画" subTitle:@"transform.translation.y" values:values8 keyTimes:keyTimes8 timingFunctions:timingFunctions8];
    
    NSArray *values9 = @[@(1.0),@(0.2),@(1.0),@(0.6),@(0.1)];
    NSArray *keyTimes9 = @[@0.0,@0.1,@0.5,@0.75,@1.0];
    NSArray *timingFunctions9 = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]
                                  ];
    
    KeyframeAnimationTVCellModel *row9 = [[KeyframeAnimationTVCellModel alloc]initWithCellClass:@"KeyframeAnimationTVCell" mainTitle:@"透明度动画" subTitle:@"opacity" values:values9 keyTimes:keyTimes9 timingFunctions:timingFunctions9];
    
    NSArray *values10 = @[(id)[UIColor yellowColor].CGColor,
                          (id)[UIColor redColor].CGColor,
                          (id)[UIColor greenColor].CGColor,
                          (id)[UIColor brownColor].CGColor,
                          (id)[UIColor blueColor].CGColor];
    NSArray *keyTimes10 = @[@0.0,@0.1,@0.5,@0.75,@1.0];
    NSArray *timingFunctions10 = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut],
                                  [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
    
    KeyframeAnimationTVCellModel *row10 = [[KeyframeAnimationTVCellModel alloc]initWithCellClass:@"KeyframeAnimationTVCell" mainTitle:@"背景色动画" subTitle:@"backgroundColor" values:values10 keyTimes:keyTimes10 timingFunctions:timingFunctions10];
    
    NSArray *values11 = @[@(20),@(25),@(30),@(25),@(15)];
    NSArray *keyTimes11 = @[@0.0,@0.1,@0.5,@0.75,@1.0];
    NSArray *timingFunctions11 = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
                                   [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn],
                                   [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut],
                                   [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
    
    KeyframeAnimationTVCellModel *row11 = [[KeyframeAnimationTVCellModel alloc]initWithCellClass:@"KeyframeAnimationTVCell" mainTitle:@"圆角动画" subTitle:@"cornerRadius" values:values11 keyTimes:keyTimes11 timingFunctions:timingFunctions11];
    
    NSArray *values12 = @[@(0),@(5),@(10),@(5),@(0)];
    NSArray *keyTimes12 = @[@0.0,@0.1,@0.5,@0.75,@1.0];
    NSArray *timingFunctions12 = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
                                   [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn],
                                   [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut],
                                   [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
    
    KeyframeAnimationTVCellModel *row12 = [[KeyframeAnimationTVCellModel alloc]initWithCellClass:@"KeyframeAnimationTVCell" mainTitle:@"边框动画" subTitle:@"borderWidth" values:values12 keyTimes:keyTimes12 timingFunctions:timingFunctions12];
    
    NSArray *values13 = @[[NSValue valueWithCGRect:CGRectMake(0, 0, 70, 70)],
                          [NSValue valueWithCGRect:CGRectMake(0, 50, 80, 80)],
                          [NSValue valueWithCGRect:CGRectMake(0, 50, 90, 90)],
                          [NSValue valueWithCGRect:CGRectMake(50, 50, 20, 20)],
                          [NSValue valueWithCGRect:CGRectMake(10, 10, 40, 40)]];
    NSArray *keyTimes13 = @[@0.0,@0.1,@0.5,@0.75,@1.0];
    NSArray *timingFunctions13 = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
                                   [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn],
                                   [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut],
                                   [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
    
    KeyframeAnimationTVCellModel *row13 = [[KeyframeAnimationTVCellModel alloc]initWithCellClass:@"KeyframeAnimationTVCell" mainTitle:@"大小动画" subTitle:@"bounds" values:values13 keyTimes:keyTimes13 timingFunctions:timingFunctions13];
    
    NSArray *values14 = @[[NSValue valueWithCGPoint:CGPointMake(0, -10)],
                          [NSValue valueWithCGPoint:CGPointMake(10, 0)],
                          [NSValue valueWithCGPoint:CGPointMake(0, 10)],
                          [NSValue valueWithCGPoint:CGPointMake(-10, 0)],
                          [NSValue valueWithCGPoint:CGPointMake(0, -10)]];
    NSArray *keyTimes14 = @[@0.0,@0.1,@0.5,@0.75,@1.0];
    NSArray *timingFunctions14 = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
                                   [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn],
                                   [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut],
                                   [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
    
    KeyframeAnimationTVCellModel *row14 = [[KeyframeAnimationTVCellModel alloc]initWithCellClass:@"KeyframeAnimationTVCell" mainTitle:@"阴影偏移量动画" subTitle:@"shadowOffset" values:values14 keyTimes:keyTimes14 timingFunctions:timingFunctions14];
    
    return @[row0,row1,row2,row3,row4,row5,row6,row7,row8,row9,row10,row11,row12,row13,row14];
}
- (NSArray *)pathAnimationRows {
    NSArray *values0 = @[[NSValue valueWithCGPoint:CGPointMake(0, 0)],
                          [NSValue valueWithCGPoint:CGPointMake(100, 100)],
                          [NSValue valueWithCGPoint:CGPointMake(150, 200)],
                          [NSValue valueWithCGPoint:CGPointMake(50, 200)],
                          [NSValue valueWithCGPoint:CGPointMake(100, 100)]];
    NSArray *keyTimes0 = @[@0.0,@0.1,@0.5,@0.75,@1.0];
    NSArray *timingFunctions0 = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear],
                                   [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn],
                                   [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut],
                                   [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
    KeyframeAnimationTVCellModel *row0 = [[KeyframeAnimationTVCellModel alloc]initWithCellClass:@"KeyframeAnimationTVCell" mainTitle:@"平面位移动画" subTitle:@"position" values:values0 keyTimes:keyTimes0 timingFunctions:timingFunctions0];
    row0.isValueCreate = NO;
    return @[row0];
}
@end
